package com.ruoyi.web.controller.system;


import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.SysRegion;
import com.ruoyi.system.service.SysRegionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author yangtianqi
 * @since 2024-06-18
 */
@RestController
@RequestMapping("/system/sysRegion")
public class SysRegionController extends BaseController {

    @Autowired
    private SysRegionService sysRegionService;
    @RequestMapping("/listByPcode")
    public AjaxResult listByPcode(String pcode){
        if (StringUtils.isEmpty(pcode)){
            return AjaxResult.success("");
        }
        return AjaxResult.success(sysRegionService.lambdaQuery().eq(SysRegion::getPcode,pcode).list());
    }

}

